<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Print</title>
    <style>
      html {
        margin: 0;
        padding: 0;
        width: 100%;
        background: #fff;
      }
      body {
        margin: auto;
        padding: 0;
        width: 21cm;
        min-height: 100vh;
        background: #f5f5f5;
      }
      h1,
      h2,
      h3 {
        page-break-after: always;
      }
      #chart-container {
        position: relative;
        height: 300px;
        overflow: hidden;
      }
    </style>
  </head>
  <body>
    <h1>1</h1>
    <h2>2</h2>
    <h2>3</h2>
    <img src="https://imagecdn.didano.com/ximapeng-website/logo2.png?t=1" />
    <div id="chart-container"></div>
    <script src="https://registry.npmmirror.com/echarts/5.4.3/files/dist/echarts.min.js"></script>
    <script>
      var dom = document.getElementById('chart-container');
      var myChart = echarts.init(dom, null, {
        renderer: 'svg',
        useDirtyRect: false,
      });
      var app = {};

      var option;

      option = {
        tooltip: {
          trigger: 'item',
        },
        legend: {
          top: '5%',
          left: 'center',
        },
        series: [
          {
            name: 'Access From',
            type: 'pie',
            radius: ['40%', '70%'],
            avoidLabelOverlap: false,
            itemStyle: {
              borderRadius: 10,
              borderColor: '#fff',
              borderWidth: 2,
            },
            label: {
              show: false,
              position: 'center',
            },
            emphasis: {
              label: {
                show: true,
                fontSize: 40,
                fontWeight: 'bold',
              },
            },
            labelLine: {
              show: false,
            },
            data: [
              { value: 1048, name: 'Search Engine' },
              { value: 735, name: 'Direct' },
              { value: 580, name: 'Email' },
              { value: 484, name: 'Union Ads' },
              { value: 300, name: 'Video Ads' },
            ],
          },
        ],
      };

      if (option && typeof option === 'object') {
        myChart.setOption(option);
      }

      window.addEventListener('resize', myChart.resize);
    </script>
  </body>
</html>
